<template>
  <div id="app">
    <!-- <Home></Home>
    <About></About> -->
    <router-link to="/login" class="hide">登录</router-link>
    <router-link to="/home" class="hide">主页</router-link>
    <router-view></router-view>
  </div>
</template>

<style lang="less" scoped>
.hide {
  display: none;
}
</style>

<script>
// import Home from './views/Home'
// import About from './views/About'
import route from './router'
export default {
  name: 'App',
  components: {
    // About,
    // Home,
  },
  watch: {
    $route () {
      console.log('路由改变', this.$route)
      if (this.$route.name !== 'Login') {
        if (!this.$store.state.isLogin) {
          route.push({ path: '/login' })
        }
      }
    }
  }
}
</script>
